

    var map = new AMap.Map('gdMap', {
        resizeEnable: true,
        zoom:11,
        center: [116.397428, 39.90923]
    });
	

var oneDay = 10 * 1000;
var date = [];

var data = [];
var now = new Date();
var nowstr="";


var intsetInterval=0;
var isinitselect = true;

var defaultTime =60;

var queryStartTime="";
var queryEndTime="";
var playStartTime="";
var playEndTime="";

var dataArray=new Array(); 
var videoCache = new HashMap();
	
$(function(){ 
	try{
		 initVehicleList();
		 $("#devid").val(deviceId);
		 $("#startDate").val(getDay(1));
		 $("#endDate").val(getDay(0));
		 $("#btnPlayBack").unbind("click");
		 $("#btnPlayBack").bind("click",PlayBack);
		 $("#btnPlayBack").html("回放");
		 
		 $("#btnVideoDown").unbind("click");
		 $("#btnVideoDown").bind("click",DownloadByTime);
		 $("#btnVideoDown").html("下载");
		 
		 
	     login(); 
		 /* 
		initVehicleList();
		 defaultTime =$("#timeOutSel").val();
		 setTimeout("afterrender()", 3000 ); 
		 
		 $("#closeVideoDiv").unbind("click");
		 $("#closeVideoDiv").bind("click",buttonCloseVideo);
		 $("#closeVideoDiv").html("关闭视频") */
	}catch(e){
		  
	}
});    

function initVehicleList(){
	$.ajax({
		type : 'post',
		async : false,
		url : appCtx + "/video/queryVideoVehicleList.html",
		cache : false,
		dataType : "JSON",
		success : function(data) {
			if(data){

				$('#selectVehicleSel').select2({
				  data: data
				})
				
				$('#selectVehicleSel').val(vehicleID).trigger("change");
			}
		}
	});

}

function timeOut(){
	if(defaultTime>0){
		defaultTime--;
		var m=Math.floor(defaultTime/60%60); 
		var s=Math.floor(defaultTime%60);
		if(m<10){
			document.getElementById("t_m").innerHTML = "0"+m + "分"; 
		}else{
			document.getElementById("t_m").innerHTML = m + "分"; 
		}
		if(s<10){
			document.getElementById("t_s").innerHTML = "0"+s + "秒";
		}else{
			document.getElementById("t_s").innerHTML = s + "秒";
		}
	}else{
		document.getElementById("t_m").innerHTML = "00" + "分";
		document.getElementById("t_s").innerHTML = "00" + "秒";
		window.clearInterval(intsetInterval);
		stopRealPlay();  
		$("#closeVideoDiv").unbind("click");
		$("#closeVideoDiv").bind("click",buttonOpenVideo);
		$("#closeVideoDiv").html("打开视频")
	}
}

function buttonOpenVideo(){
	 defaultTime =$("#timeOutSel").val();
	 realPlay();
	 intsetInterval=window.setInterval("timeOut();", 1000);
	 $("#closeVideoDiv").unbind("click");
	 $("#closeVideoDiv").bind("click",buttonCloseVideo);
	 $("#closeVideoDiv").html("关闭视频")
}
function buttonCloseVideo(){
	defaultTime=0;
	document.getElementById("t_m").innerHTML = "00" + "分";
	document.getElementById("t_s").innerHTML = "00" + "秒";
	window.clearInterval(intsetInterval);
	stopRealPlay();
	$("#closeVideoDiv").unbind("click");
	$("#closeVideoDiv").bind("click",buttonOpenVideo);
	$("#closeVideoDiv").html("打开视频")
}/* 
function setTimeOut(){
	realPlay();
	 $("#resetTimeout").hide();
	 $("#time_label").show();
	defaultTime = videoOverTime;
} */
IScanClientOCXCtrlParam = function(){ 
    return {
        resultInitial:null,
        resultLogin:null,
        videoCtrl : new Array(17),//针对通道，包括通道信息(data:object)、是否打开声音(sound:bool)，从1开始
        curPresetControl : -1, //39表示调用，8表示设置，9表示删除
        talkCtrl : null,//已打开对讲的设备信息,
		talkDevAddr: null, // 已打开对讲设备地址
		talkDevName: null, // 已打开对讲设备名
        deviceAddress:null,//设备地址
        devName:null,
        state:null,//判断是否已经登录
        picturePath : 'D:\\iscanPicture\\',
        vedioPath : 'D:\\iscanVedio\\',
        groupsCtrl: new Array(64),
        sound_first:0,//获取窗口消息，实时存取窗口号
        sound_third:0,//打开声音后的窗口号
        sound_fouth:0,//打开第二个窗口后，存放第一个窗口号
        errorInfo :['没有对讲权限','登录dns服务器失败','连接流媒体服务器失败','网络响应超时','网络错误','由于网络原因或DVR忙，注册失败（连接服务器失败）',
            '超过了用户所在机构下的最大输出流','超过了流媒体的最大输出数限制','超过了服务器最大的输出流','没有视频监控权限','未知错误',
            '连续登录失败次数超过限定，用户将被锁定一段时间','多次登录失败，需退出程序','用户密钥错误','用户已过期','版本不匹配',
            '用户被禁用','用户已经登录','服务器地址无效','用户没有权限','用户名或密码错误','连接服务器失败','无效参数','内存错误',
            '没有登录','参数没有初始化','登录失败','登录成功'],
        destroy : function(){
            this.videoCtrl = new Array(17);
            this.talkCtrl = null;
            this.deviceAddress = null;
            this.state = null;
            this.picturePath = 'D:\\iscanPicture\\';
            this.vedioPath = 'D:\\iscanVedio\\';
			this.talkDevAddr = null;
			this.talkDevName = null;
        }
    }
}();

function afterrender(){
   
	login();
	
	setTimeout(function(){
		realPlay();
	},5000)
    
}
//键盘控制回车登录事件；
document.onkeydown = function(e){
    e = window.event || e;
    var ke = e.keyCode || e.which;
    if(13 == ke){
        login();
    }
}  
//登录
function login(){ 
    if(IScanClientOCXCtrlParam.state){
        alert("请退出系统再重新登录");
        return;
    }
     //user = "yccs";
     //password = "123456";
     //ip = "211.162.75.141";
     //port = "52460";
   
    if(!user||!password||!ip||!port){
        alert('用户名、密码、ip或端口号为空');
        return;
    }

    var resultInitial = IScanClientOCXCtrl.CX_Initial(ip, port, '0', '0');
    IScanClientOCXCtrl.CX_SetVideoMode(1);
    if(0 != resultInitial){
        alert('插件初始化失败,请检查是否安装!')
        return;
    }
    var resultLogin = IScanClientOCXCtrl.CX_Login(user, password);
    for(var i = 0;i < IScanClientOCXCtrlParam.errorInfo.length;i++){
        if((resultLogin + 27) == 27){ 
           
            IScanClientOCXCtrlParam.state = true;
          
            break;
        }else if(i == (resultLogin + 27)){
            var errorInfo = IScanClientOCXCtrlParam.errorInfo[i]
            alert(errorInfo);//输出错误信息
            return;
        }
    }
    IScanClientOCXCtrlParam.resultInitial = resultInitial;
    IScanClientOCXCtrlParam.resultLogin = resultLogin;
    var deviceList = IScanClientOCXCtrl.CX_GetDeviceList();
   
}


//实时预览
function realPlay(){ 
    if(0 == IScanClientOCXCtrlParam.resultInitial && 0== IScanClientOCXCtrlParam.resultLogin){
 
        var result = IScanClientOCXCtrl.CX_RealPlay(0, deviceId, 1, 0);
        if(0 == result){
            IScanClientOCXCtrlParam.videoCtrl[0] = new Object();
            IScanClientOCXCtrlParam.videoCtrl[0].devAddress = deviceId;
            IScanClientOCXCtrlParam.videoCtrl[0].channelNum = 1;
            IScanClientOCXCtrlParam.videoCtrl[0].devName = RegistrationNO;
            IScanClientOCXCtrlParam.videoCtrl[0].sound = false;
            IScanClientOCXCtrl.CX_PTZControl(0,8,63,0);
        }
		var result2 = IScanClientOCXCtrl.CX_RealPlay(1, deviceId, 2, 1);
        if(0 == result2){
            IScanClientOCXCtrlParam.videoCtrl[1] = new Object();
            IScanClientOCXCtrlParam.videoCtrl[1].devAddress = deviceId;
            IScanClientOCXCtrlParam.videoCtrl[1].channelNum = 2;
            IScanClientOCXCtrlParam.videoCtrl[1].devName = RegistrationNO;
            IScanClientOCXCtrlParam.videoCtrl[1].sound = false;
            IScanClientOCXCtrl.CX_PTZControl(1,8,63,0);
        }
		var result3 = IScanClientOCXCtrl.CX_RealPlay(2, deviceId, 3, 2);
        if(0 == result3){
            IScanClientOCXCtrlParam.videoCtrl[2] = new Object();
            IScanClientOCXCtrlParam.videoCtrl[2].devAddress = deviceId;
            IScanClientOCXCtrlParam.videoCtrl[2].channelNum = 3;
            IScanClientOCXCtrlParam.videoCtrl[2].devName = RegistrationNO;
            IScanClientOCXCtrlParam.videoCtrl[2].sound = false;
            IScanClientOCXCtrl.CX_PTZControl(2,8,63,0);
        }
		var result4 = IScanClientOCXCtrl.CX_RealPlay(3, deviceId, 4, 3);
        if(0 == result4){
            IScanClientOCXCtrlParam.videoCtrl[3] = new Object();
            IScanClientOCXCtrlParam.videoCtrl[3].devAddress = deviceId;
            IScanClientOCXCtrlParam.videoCtrl[3].channelNum = 4
            IScanClientOCXCtrlParam.videoCtrl[3].devName = RegistrationNO;
            IScanClientOCXCtrlParam.videoCtrl[3].sound = false;
            IScanClientOCXCtrl.CX_PTZControl(3,8,63,0);
        }
        soundOpen();
    }
}
//
function  stopRealPlay(){
    if(0 == IScanClientOCXCtrlParam.resultInitial && 0== IScanClientOCXCtrlParam.resultLogin){
    	var port0 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(0);
        var result0 = IScanClientOCXCtrl.CX_StopRealPlay(0);
        var port1 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(1);
        var result1 = IScanClientOCXCtrl.CX_StopRealPlay(1);
        var port2 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(2);
        var result2 = IScanClientOCXCtrl.CX_StopRealPlay(2);
    	var port3 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(3);
        var result3 = IScanClientOCXCtrl.CX_StopRealPlay(3);
        if(0 == result1){
        	IScanClientOCXCtrlParam.videoCtrl[0] = null;
        	IScanClientOCXCtrlParam.videoCtrl[1] = null;
        	IScanClientOCXCtrlParam.videoCtrl[2] = null;
        	IScanClientOCXCtrlParam.videoCtrl[3] = null;
        }else{
            alert('停止预览失败，请确认该窗口视频是否打开！')
        }
        //soundClose();
        
    }
}

//打开声音
function soundOpen(){
    if(0 == IScanClientOCXCtrlParam.resultInitial && 0== IScanClientOCXCtrlParam.resultLogin){    
        var port1 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(1);   
        if(IScanClientOCXCtrlParam.videoCtrl[1].sound){
            //                        var res = IScanClientOCXCtrl.CX_StopSound(curSelWinNum);
            //                        IScanClientOCXCtrlParam.videoCtrl[curSelWinNum].sound = false;
            return;
        }else{
            var result1 = IScanClientOCXCtrl.CX_PlaySound(port1);
            if(0 == result1){
                IScanClientOCXCtrlParam.videoCtrl[1].sound = true
            }      
        }
        
        var port2 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(2);   
        if(IScanClientOCXCtrlParam.videoCtrl[1].sound){
            //                        var res = IScanClientOCXCtrl.CX_StopSound(curSelWinNum);
            //                        IScanClientOCXCtrlParam.videoCtrl[curSelWinNum].sound = false;
            return;
        }else{
            var result2 = IScanClientOCXCtrl.CX_PlaySound(port2);
            if(0 == result2){
                IScanClientOCXCtrlParam.videoCtrl[1].sound = true
            }      
        }
        
        var port3 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(3);   
        if(IScanClientOCXCtrlParam.videoCtrl[1].sound){
            //                        var res = IScanClientOCXCtrl.CX_StopSound(curSelWinNum);
            //                        IScanClientOCXCtrlParam.videoCtrl[curSelWinNum].sound = false;
            return;
        }else{
            var result3 = IScanClientOCXCtrl.CX_PlaySound(port3);
            if(0 == result3){
                IScanClientOCXCtrlParam.videoCtrl[1].sound = true
            }      
        }


    }
}
//关闭声音
function soundClose(){
    if(0 == IScanClientOCXCtrlParam.resultInitial && 0== IScanClientOCXCtrlParam.resultLogin){
       
        var port1 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(1);
        if(IScanClientOCXCtrlParam.videoCtrl[1].sound){
            var res1 = IScanClientOCXCtrl.CX_StopSound(port1);
            if(0 == res1){
                IScanClientOCXCtrlParam.sound_first = 0;
                IScanClientOCXCtrlParam.sound_third = 0;
                IScanClientOCXCtrlParam.sound_fouth = 0;
                IScanClientOCXCtrlParam.videoCtrl[1].sound = false;
            }

        }
        var port2 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(2);
        if(IScanClientOCXCtrlParam.videoCtrl[1].sound){
            var res2 = IScanClientOCXCtrl.CX_StopSound(port2);
            if(0 == res2){
                IScanClientOCXCtrlParam.sound_first = 0;
                IScanClientOCXCtrlParam.sound_third = 0;
                IScanClientOCXCtrlParam.sound_fouth = 0;
                IScanClientOCXCtrlParam.videoCtrl[1].sound = false;
            }

        }
        var port3 = IScanClientOCXCtrl.CX_GetPlayPortByWndNum(3);
        if(IScanClientOCXCtrlParam.videoCtrl[1].sound){
            var res3 = IScanClientOCXCtrl.CX_StopSound(port3);
            if(0 == res3){
                IScanClientOCXCtrlParam.sound_first = 0;
                IScanClientOCXCtrlParam.sound_third = 0;
                IScanClientOCXCtrlParam.sound_fouth = 0;
                IScanClientOCXCtrlParam.videoCtrl[1].sound = false;
            }

        }
    }
}



function QueryDevRecordFiles(){
	queryStartTime=$.trim($('#startDate').val());
	queryEndTime=$.trim($('#endDate').val());
	
	dataArray=[];
	videoCache.clear();
	var obj=document.getElementById('videoBack'); 
	obj.options.length=0;
	

	queryStartTime=queryStartTime.substr(0,4)+queryStartTime.substr(5,2)+queryStartTime.substr(8,2)+queryStartTime.substr(11,2)+queryStartTime.substr(14,2)+queryStartTime.substr(17,2);
	queryEndTime=queryEndTime.substr(0,4)+queryEndTime.substr(5,2)+queryEndTime.substr(8,2)+queryEndTime.substr(11,2)+queryEndTime.substr(14,2)+queryEndTime.substr(17,2);
	
    var channelNum = document.getElementById("ChannelNo").value;     
    var videoType = 'history';        
	 // alert(startTime + "," + endTime + "," + devId + "," + videoType + ","  + channelNum);
   	var vedioList = IScanClientOCXCtrl.CX_QueryVideoFlie(queryStartTime, queryEndTime, deviceId, videoType, channelNum);
   	var xmlDoc=loadXML(vedioList);
   	var elements = xmlDoc.getElementsByTagName("NodeInfo");
	if(elements.length==0){
		alert("没有找到查询日期内的视频资料！");
		return;
	}
	for (var i = 0; i < elements.length; i++) {
		var fileData= new Object();
        var fileName = elements[i].getElementsByTagName("NodeFilename")[0].firstChild.nodeValue;
        fileData.FileName=fileName;
        var fileSize = elements[i].getElementsByTagName("NodeFileSize")[0].firstChild.nodeValue; 
        fileData.FileSize=fileSize;
        var startTime = elements[i].getElementsByTagName("NodeStartTime")[0].firstChild.nodeValue; 
        fileData.startTime=startTime;
        var stopTime = elements[i].getElementsByTagName("NodeEndTime")[0].firstChild.nodeValue; 
        fileData.stopTime=stopTime;
        fileData.Channel=channelNum;
        var videoBackSelect=document.getElementById("videoBack");
      
        var a=new Option();
        a.value=fileName;
        a.text=startTime.substr(0,4)+"-"+startTime.substr(4,2)+"-"+startTime.substr(6,2)+" "+startTime.substr(8,2)+":"+startTime.substr(10,2)+":"+startTime.substr(12,2)+"~"+stopTime.substr(8,2)+":"+stopTime.substr(10,2)+":"+stopTime.substr(12,2);
        videoBackSelect.options.add(a);
        dataArray.push(fileData);
        videoCache.put(fileName,fileData);
	}
	playStartTime=dataArray[0].startTime;
	playEndTime=dataArray[0].stopTime;
	var fileflag=elements[0].getElementsByTagName("NodeFilename")[0].firstChild.nodeValue;
	$("#filename").val(fileflag);
	
} 

function PlayBack(){
	
	
	 
	 
	var channelNum = document.getElementById("ChannelNo").value;
	if(!playStartTime||!playStartTime||playStartTime==""||playEndTime==""){
		alert("请先查询录像，并选择所需回放的录像段！");  
		return;
	}
	var playCode = IScanClientOCXCtrl.CX_PlayVideoFile(deviceId, playStartTime, playEndTime, channelNum, 0);  
	$("#btnPlayBack").unbind("click");
	 $("#btnPlayBack").bind("click",StopBack);
	 $("#btnPlayBack").html("停止");
	if(playCode == 0){
		console.log("开始播放录像！");
	}else{
		console.log("播放录像失败！");
	}
}

function StopBack(){
	
	
	 
	 
	var playCode = IScanClientOCXCtrl.CX_StopVideoPlay(0);      
	if(playCode == 0){
		console.log( "停止回放成功！");
	}else{
		console.log("停止回放失败！");
	}
	$("#btnPlayBack").unbind("click");
	 $("#btnPlayBack").bind("click",PlayBack);
	 $("#btnPlayBack").html("回放");
}

function DownloadByTime(){
	$("#btnVideoDown").unbind("click");
	$("#btnVideoDown").bind("click",stopDownloadVedioFile);
	$("#btnVideoDown").html("停止");
	
	var channelNum = document.getElementById("ChannelNo").value;

	if(!playStartTime||!playStartTime||playStartTime==""||playEndTime==""){
		alert("请先查询录像，并选择所需下载的录像段！");  
		return;
	}
	
	var pictureName = deviceId + '_' + channelNum + '_' + playStartTime + '.mp4'; 
	
	var filePath="D:\\vedio\\"+playStartTime+"_"+playEndTime+".mp4";
	
/* 	var pictureName = deviceId + '_' + channelNum + '_' + playStartTime + '.mp4'; 
	
	var filePath="D:\\vedio\\"+deviceId + '_' + channelNum +".mp4"; */
	var nOperateType = 0;
    var Offset = 0;
    var code = IScanClientOCXCtrl.CX_DownLoadVideoFile(filePath, playStartTime, playEndTime, deviceId, nOperateType, channelNum, Offset);      
	if(code == 0){
		alert("操作成功，开始下载！");
	}else{
		alert("下载录像失败！");
	}
	intsetInterval=window.setInterval("showDownloadByTime();", 2000);
	
}

//停止下载
function stopDownloadVedioFile(){
	$("#btnVideoDown").unbind("click");
	$("#btnVideoDown").bind("click",DownloadByTime);
	$("#btnVideoDown").html("下载");
	 window.clearInterval(intsetInterval);
      var code = IScanClientOCXCtrl.CX_StopDownVideoFile(deviceId);    
      if(code == 0){
							alert("停止下载成功！");
					}else{
						  alert("停止下载失败！");
					}
}


function showDownloadByTime(){
	
	var nPos=IScanClientOCXCtrl.CX_GetDownLoadPos(deviceId);
	if(nPos==100){
		 window.clearInterval(intsetInterval);
	}
	alert("当前下载进度  "+nPos+"% !");
}

function addData(shift) {
    var hourstr=now.getHours() < 10 ? "0" + now.getHours() : now.getHours();
    var minutestr=now.getMinutes() < 10 ? "0" + now.getMinutes() : now.getMinutes();
    var secondstr=now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();
    nowstr = [hourstr, minutestr, secondstr].join(':');
    date.push(nowstr);
    data.push(parseFloat(Math.random() * 30+50).toFixed(1));

    if (shift) {
        date.shift();
        data.shift();
    }

    now = new Date(+new Date(now) + oneDay);
}



option = {
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: date
    },
    tooltip: {
        trigger: 'axis',
        formatter: function (params) {
            params = params[0];
            return "时间:"+params.name+"<br/>"+"速度"+params.value;
        },
        axisPointer: {
            animation: false
        }
    },
    yAxis: {
        boundaryGap: [0, '50%'],
        name : '速度(km/h)',
	    type : 'value',
	    max : 150,
    },
    series: [
        {
            name:'速度',
            type:'line',
            smooth:true,
            symbol: 'none',
            stack: 'a',
            areaStyle: {
                normal: {}
            },
            data: data
        }
    ]
};
var myChart = echarts.init(document.getElementById('speedCharts'));
	myChart.setOption(option);
setInterval(function () {
    addData(false);
    myChart.setOption({
        xAxis: {
            data: date
        },
        series: [{
            name:'速度',
            data: data
        }]
    });
}, 10000);

	
//打开新窗体
function openWindow(url){
	var openLink = $("#txtOpenWindow");
	openLink.attr('href', url);
	openLink[0].click();
}

function changeVechile(){
	if(isinitselect){
		isinitselect=false;
	}else{

			try{
				exitstopplay();
			}catch(e){
				
			}
			
			var vid=$("#selectVehicleSel").val();
			openWindow(appCtx + "/video/hisVideo.html?vehicleID="+vid);

		
	}
}

function downLoadVideo(){
	
}

function setVideo(){
	$('#myModal').modal('show');
}

function closeVideo(){
	$('#myModal').modal('hide');
}

/**
 * 获取今天之前的日期
 * @param day
 */
function getDay(day){
	var today = new Date(); 
	return getCalcuDay(today,day);
}
/**
 * 获取指定日期的前几天
 * @param today
 * @param day
 * @returns {String}
 */
function getCalcuDay(today,day){
    var targetday_milliseconds=today.getTime() - 1000*60*60*24*day;          

    today.setTime(targetday_milliseconds); //注意，这行是关键代码    
      
    var tYear = today.getFullYear();  
    var tMonth = today.getMonth();  
    var tDate = today.getDate();  
    var tHuors= today.getHours();
    var tMinutes= today.getMinutes();
    var tSeconds= today.getSeconds();
    
    tMonth = doHandleMonth(tMonth + 1);  
    tDate = doHandleMonth(tDate);  
    tHuors = doHandleMonth(tHuors);  
    tMinutes = doHandleMonth(tMinutes);  
    tSeconds = doHandleMonth(tSeconds); 
    return tYear+"-"+tMonth+"-"+tDate+" "+tHuors+":"+tMinutes+":"+tSeconds;  
} 
function doHandleMonth(month){  
    var m = month;  
    if(month.toString().length == 1){  
       m = "0" + month;  
    }  
    return m;  
} 

var loadXML = function(xmlString){
    var xmlDoc=null;
    //判断浏览器的类型
    //支持IE浏览器 
    if(!window.DOMParser && window.ActiveXObject){   //window.DOMParser 判断是否是非ie浏览器
        var xmlDomVersions = ['MSXML.2.DOMDocument.6.0','MSXML.2.DOMDocument.3.0','Microsoft.XMLDOM'];
        for(var i=0;i<xmlDomVersions.length;i++){
            try{
                xmlDoc = new ActiveXObject(xmlDomVersions[i]);
                xmlDoc.async = false;
                xmlDoc.loadXML(xmlString); //loadXML方法载入xml字符串
                break;
            }catch(e){
            }
        }
    }
    //支持Mozilla浏览器
    else if(window.DOMParser && document.implementation && document.implementation.createDocument){
        try{
            /* DOMParser 对象解析 XML 文本并返回一个 XML Document 对象。
             * 要使用 DOMParser，使用不带参数的构造函数来实例化它，然后调用其 parseFromString() 方法
             * parseFromString(text, contentType) 参数text:要解析的 XML 标记 参数contentType文本的内容类型
             * 可能是 "text/xml" 、"application/xml" 或 "application/xhtml+xml" 中的一个。注意，不支持 "text/html"。
             */
            domParser = new  DOMParser();
            xmlDoc = domParser.parseFromString(xmlString, 'text/xml');
        }catch(e){  
        }
    }
    else{
        return null;
    }

    return xmlDoc;
}

function changeBackSelect(){
	var keyname=$("#videoBack").val();
	var objVideo=videoCache.get(keyname);
	
	playStartTime=objVideo.startTime;
	playEndTime=objVideo.stopTime;
}
